<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>比较两个数或对象的 key value 是否一致。</title>
</head>

<body>
  <script>
    let key = {
      name: '小刚'
    }
    let obj = {
      name: '小李'
    }
    console.log(JSON.stringify(key) === JSON.stringify(obj))
  </script>
</body>

</html>